<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/11/29
  Time: 9:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/layui/layui.js"
            charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="layui-anim layui-anim-up">
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">财务管理</a>
      </span>
    <a class="layui-btn layui-btn-primary layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:38px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form layui-col-md12 x-so" id="f1"
          action="${pageContext.request.contextPath}/income/incomeOutMaterialList.do">
        <div class="layui-row">
            <input type="text" id="like1" value="${likename1}" name="likename1" placeholder="请输入:年-月" autocomplete="off"
                   class="layui-input">
            <button class="layui-btn" type="submit" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>
            </button>
            <input type="hidden" id="pageNum" name="pageNum">
            <input type="hidden" id="pageSize" name="pageSize">
            <button class="layui-btn" id="re" type="button"><i class="layui-icon">清空</i>
            </button>
        </div>
        <xblock>

            <span class="x-right" style="line-height:40px">
            当前第${pageInfo.pageNum}页/共${pageInfo.pages}页，共${pageInfo.total}条数据
        </span>
        </xblock>
    </form>
    <table class="layui-table">
        <thead>
        <tr>
            <th>id</th>
            <th>月份所有订单id</th>
            <th>年</th>
            <th>月</th>
            <th>原料名</th>
            <th>购买数量</th>
            <th>单价</th>
            <th>总价</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="income" items="${pageInfo.list}">
            <tr>
                <td>${income.id}</td>
                <td>${income.purchaseOrderItemId}</td>
                <td>${income.year}</td>
                <td>${income.month}</td>
                <td>${income.materialName}</td>
                <td>${income.quantity}</td>
                <td>${income.unitPrice}</td>
                <td>${income.totalPrice}</td>

            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="page">
        <div>
            <a href="javascript:go(1)" class="num">首页</a>
            <c:if test="${pageInfo.hasPreviousPage}">
                <a href="javascript:go(${pageInfo.prePage})" class="prev">&lt;&lt;</a>
            </c:if>
            <c:choose>
                <c:when test="${pageInfo.pages<=10}">
                    <c:set var="begin" value="1"></c:set>
                    <c:set var="end" value="${pageInfo.pages}"></c:set>
                </c:when>
                <c:otherwise>
                    <c:set var="begin" value="${pageInfo.pageNum-5}"></c:set>
                    <c:set var="end" value="${pageInfo.pageNum+4}"></c:set>
                    <c:if test="${begin<1}">
                        <c:set var="begin" value="1"></c:set>
                        <c:set var="end" value="10"></c:set>
                    </c:if>
                    <c:if test="${end>pageInfo.pages}">
                        <c:set var="begin" value="${pageInfo.pages-9}"></c:set>
                        <c:set var="end" value="${pageInfo.pages}"></c:set>
                    </c:if>
                </c:otherwise>
            </c:choose>
            <c:forEach var="i" begin="${begin}" end="${end}">
                <a href="javascript:go(${i})">
                    <c:if test="${i==pageInfo.pageNum}">
                        <span class="current">${i}</span>
                    </c:if>
                    <c:if test="${i!=pageInfo.pageNum}">
                        <span>${i}</span>
                    </c:if>
                </a>
            </c:forEach>
            <c:if test="${pageInfo.hasNextPage}">
                <a href="javascript:go(${pageInfo.nextPage})" class="next">&gt;&gt;</a>
            </c:if>
            <a href="javascript:go(${pageInfo.pages})" class="num">尾页</a>
        </div>
    </div>
</div>
<script>
    function go(pageNum) {
        $("#pageNum").val(pageNum)
        let ps = $("#ps").val();
        $("#pageSize").val(ps)
        $("#f1").submit();
    }

    $("#ps").change(function () {
        let ps = $("#ps").val();
        $("#pageSize").val(ps)
        $("#f1").submit();
    })
    $("#cls").click(function () {
        $("#like1").val("")
    })
    $("#qx").click(function () {
        var skr = $("input:checkbox");
        for (var i = 0; i < skr.length; i++) {
            skr[i].checked = true
        }
    })


    $("#re").click(function () {
        $("#like").val("")
        $(".layui-input").val("")
    })
</script>
</body>

</html>
